﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

[Serializable]
public class KeyContent
{
    public KeyContent()
    {
        StartTime = DateTime.Now;
        ExpireTime = DateTime.MaxValue;
        MaxDays = 0;
    }
    public DateTime StartTime { get; set; }
    public DateTime ExpireTime { get; set; }
    public int MaxDays { get; set; }

    public static KeyContent GenerateKey(DateTime start, DateTime exprie)
    {
        KeyContent kc = new KeyContent();
        kc.StartTime = start;
        kc.ExpireTime = exprie;
        return kc;
    }

    public static KeyContent GenerateKey(DateTime start, int days)
    {
        return GenerateKey(start, start.AddDays(days));
    }

    public static KeyContent GenerateKey(int days = 30)
    {
        return GenerateKey(DateTime.Now, days);
    }
}